import jdk.swing.interop.SwingInterOpUtils;

import java.util.Date;
;//导入这个所有都能用 util.*

class Student {  //定义类和类名
    private String name;
    private int age;
    private String sex;
    public static String classRoom = "112 java";
//被public修饰的都能访问 private被封装的意思，这两个符号都叫 访问修饰限定符：public,private(权限受限 ),default(默认权限),protected

    //方法的构造
    public Student() {
        System.out.println("不带参数的构造方法");
    }

    public Student(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        System.out.println("带有三个参数的构造方法");
    }




    //成员方法
    public void sleep(){System.out.println(this.name+"正在睡觉");}
    public void show(){System.out.println("姓名："+this.name+" 年龄："+this.age+"性别："+this.sex);}
    public void eat(){System.out.println(this.name+"正在吃饭");}
    public void setName(String name){this.name=name;}    //当name被private修饰时，需要此方法setname;getname;
    public String getName(){return this.name;}
    public int getAge() {return age;}
    public void setAge(int age) {this.age = age;}
    public String getSex() {return sex;}
    public void setSex(String sex) {this.sex = sex;}

     public static String getClassRoom(){
    Student student=new Student("冠宇",13,"男");
   student.eat();
        return classRoom;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                '}';
    }
}



//类的使用者
public class test2 {
    public static void main2(String[] args) {
        Date date = new Date();
        int[] array = {2, 3, 4};
        // Arrays.toString(array);
    }


    public static void main(String[] args) {
     /*    Student student1=new Student();
       //  student1.name="王五";
        student1.setName("wangwu ");
         student1.eat();
        System.out.println(student1.getName());//直接打印getname就是被封装的名字*/
        //Student student1=new Student("冠宇",12,"男");
        /*Student student2=new Student("善涵",9,"男");
        Student student3=new Student("文博",52,"男");

        System.out.println(Student.classRoom );//合理
     Student student1=null;//静态成员变量不依赖对象
        System.out.println();*/
        Student student = new Student("冠宇", 10, "男");
        student.show();
    }
}
